import { fetchJson } from '@/lib/utils/server'; import { ResultDto } from '@/types/response/common'; import { ChannelDetail } from '@/types/channel'; import { notFound } from 'next/navigation'; import Link from 'next/link'; import './style.scss'; type Props = { params: Promise<{ channelSID: string }>; }; function formatCount(n: number): string { if (n >= 10000) return `${(n / 10000).toFixed(n >= 100000 ? 0 : 1)}만`; if (n >= 1000) return `${(n / 1000).toFixed(1)}천`; return n.toLocaleString(); } export default async function ChannelPage({ params }: Props) { const { channelSID } = await params; const res: ResultDto = await fetchJson(`/api/channel/${channelSID}`, { method: 'GET' }); if (!res.data) { notFound(); } const ch = res.data; return (
{/* 배너 */}
{ch.bannerUrl && ( {`${ch.name} )}
{/* 프로필 */}
{/* 썸네일 */} {ch.thumbnailUrl ? ( {ch.name} ) : (
{ch.name.charAt(0)}
)} {ch.isLive && LIVE}
{/* 채널명 + 메타 */}

{ch.name} {ch.isVerified && }

{ch.handle && @{ch.handle}} {(ch.subscriberCount ?? 0) > 0 && 구독자 {formatCount(ch.subscriberCount)}명} {(ch.videoCount ?? 0) > 0 && 동영상 {ch.videoCount.toLocaleString()}개}
{/* 데스크톱 전용: 메타 아래 인라인 */}
구독 후원하기
{/* 모바일 전용: 프로필 아래 별도 줄 */}
구독 후원하기
{/* 라이브 상태 */} {ch.isLive && (
{ch.liveTitle} 방송 보러가기 →
)} {/* 탭 네비게이션 */} {/* 소개 탭 콘텐츠 */}
{ch.description ? (

{ch.description}

) : (

채널 소개가 없습니다

)}
); }